UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'doj5E4wJh4dM/XAUd0lyViMarLrB3t/YVi38RtMLsow=' 
WHERE 
  key_id = 'eab171f86260c4d40e4b29d5a948bc4359f4983b36e7991cdaa782fc0dac3cae' 
  AND (
    token = 'doj5E4wJh4dM/XAUd0lyViMarLrB3t/YVi38RtMLsow=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039