UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D+OafFq4+g6FjqaXTkfSnPxeKiAHs99WtOacDtr0s10=' 
WHERE 
  key_id = 'a079d642879541b0dc6a0b55996c9e7776ea98859c5916d70fdb9d0d05007970' 
  AND (
    token = 'D+OafFq4+g6FjqaXTkfSnPxeKiAHs99WtOacDtr0s10=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045