UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cBBNKEHQDoxzYSrU6SQnPrxzDRAyKvQScoLzlC0dgGw=' 
WHERE 
  key_id = '29c55b7ee5e0875f81f8877f1231e0827158496449bf85cbe5661763e853af72' 
  AND (
    token = 'cBBNKEHQDoxzYSrU6SQnPrxzDRAyKvQScoLzlC0dgGw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040