UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wOGdQvljarbAWKhr04AWbaFyp47pp6k7JIZgItr3nHo=' 
WHERE 
  key_id = 'e77e80dbdc783835090f69bce59b1ab3059943e134e7b7d3e643aa48c0a11856' 
  AND (
    token = 'wOGdQvljarbAWKhr04AWbaFyp47pp6k7JIZgItr3nHo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042