UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qMLyQuXzg0hyXJv97N31CgYJ8byDfQe+Sr7HuudN3uM=' 
WHERE 
  key_id = 'a3f4901518eaa0dba74f8a541608d86d92b4e16ca3ad48568756e77e153c44d4' 
  AND (
    token = 'qMLyQuXzg0hyXJv97N31CgYJ8byDfQe+Sr7HuudN3uM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038