UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X3GQtfWAD+Bbode3lKTTSre3Q+Kmxgx8v3LlujUs0oU=' 
WHERE 
  key_id = '77a5377a92377e3a41d0b127842f75c4cdf92d28e879c0c6099951d7324ba6f9' 
  AND (
    token = 'X3GQtfWAD+Bbode3lKTTSre3Q+Kmxgx8v3LlujUs0oU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030