UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FcgJdDvyhC9SNmyhQvoJqmOlVR2aTctA+RSFcwmTsU4=' 
WHERE 
  key_id = 'afe29f4298c57a05978cadda947e87a943804c6b5c01e747772e1e291f7a845b' 
  AND (
    token = 'FcgJdDvyhC9SNmyhQvoJqmOlVR2aTctA+RSFcwmTsU4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051