UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GfOUYApvgq/s3a61pZIaxUUGI/chDvMgumiOm512HUU=' 
WHERE 
  key_id = 'c3475306f67b9dc848152082cf7676babd0f10d68d66fb5888fc5427e4827b95' 
  AND (
    token = 'GfOUYApvgq/s3a61pZIaxUUGI/chDvMgumiOm512HUU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027