UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AZyQh7RgncyCGUCPMozicDQNgsRp15Kg5NpOUf04cU8=' 
WHERE 
  key_id = '2cc401fbd16d1aeeb0a0e36cef403ff62acc0bb0d9707e5a0779332d0d5d4a6b' 
  AND (
    token = 'AZyQh7RgncyCGUCPMozicDQNgsRp15Kg5NpOUf04cU8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040