UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LTmWiAd+pe5/aVWbfc8VqDTR/flniW1xJfNDl4dwc+o=' 
WHERE 
  key_id = '58a09cff40f3815f9e4b5d363f5e23a78d67601f39250a8a315f84dbc772d48d' 
  AND (
    token = 'LTmWiAd+pe5/aVWbfc8VqDTR/flniW1xJfNDl4dwc+o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037