UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CwWrSv2XATVHWuln/r30YI1Xe8LocBKgmlB+Q67j3nQ=' 
WHERE 
  key_id = '23349aab74b0cfb25ec30e5f2d4c0a12de8b17212c9ebcaa0b9e0df2581f13b6' 
  AND (
    token = 'CwWrSv2XATVHWuln/r30YI1Xe8LocBKgmlB+Q67j3nQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021