UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OfvopLEfXWn1x5EtoeykDXjf86EX0mom+m35zK/u560=' 
WHERE 
  key_id = 'e96b080c2c46725b5c74861a871915f5d58ed4899f066626e02b27978c08795b' 
  AND (
    token = 'OfvopLEfXWn1x5EtoeykDXjf86EX0mom+m35zK/u560=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044