UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pA7j++BhLI0dSKZ0adWjsq03foelEs1TdoayYMGVFIo=' 
WHERE 
  key_id = 'a532fb87047aa9cfc796668d119029e1339d53a5fe7f3a28f89c6193b9a3354e' 
  AND (
    token = 'pA7j++BhLI0dSKZ0adWjsq03foelEs1TdoayYMGVFIo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045