UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yq8G2r9bA+npCLs0WlMJXo2LiIHKWCT5nWLRFPWxPIM=' 
WHERE 
  key_id = '61d166fac07ced819d4ca078c0dccd333452f0e4134e07ce74f4d99afc8bd388' 
  AND (
    token = 'yq8G2r9bA+npCLs0WlMJXo2LiIHKWCT5nWLRFPWxPIM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00013