UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '/RWrLQh9+cVKXSyYAcizAewKmWEeK6Y094XVRcOVZAM=' 
WHERE 
  key_id = '5ae09918fe3614f3042f49297238ea9693aa5e9ac96c65b7de35daf222b3a806' 
  AND (
    token = '/RWrLQh9+cVKXSyYAcizAewKmWEeK6Y094XVRcOVZAM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031