UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yXOyxHmE5NmTc62JrMEMEqopzNOjpEJhZX4goSJ+xcA=' 
WHERE 
  key_id = '5ab760f91b6d9a32a678c8166904968dd61672b337960478be5d0fe238c690b6' 
  AND (
    token = 'yXOyxHmE5NmTc62JrMEMEqopzNOjpEJhZX4goSJ+xcA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038