UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nUKcc8PV2rqtyVZbYXrXfZe+pmTQjLXBLnB+mRFa0ss=' 
WHERE 
  key_id = 'bc64bdd1a33eb396f1f8cf147bc92345a475e7f4aaaf9407182add325180c179' 
  AND (
    token = 'nUKcc8PV2rqtyVZbYXrXfZe+pmTQjLXBLnB+mRFa0ss=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029