UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FQ29wZbtoCJC+0a3SFoqlKNVDukri4sd0BUnBJ1ZEZg=' 
WHERE 
  key_id = 'cf7f1d8fa3771039ece6eaeb27386b1a03d61c17648113844c85f2556345daeb' 
  AND (
    token = 'FQ29wZbtoCJC+0a3SFoqlKNVDukri4sd0BUnBJ1ZEZg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038