UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MSavNDl2lqJMczS7pLtebZOu8Uhighxx+7za29Lv0qc=' 
WHERE 
  key_id = '2b1d874569926c9794627ffdbef0e24fc6847683ead717dc552ac15af3044041' 
  AND (
    token = 'MSavNDl2lqJMczS7pLtebZOu8Uhighxx+7za29Lv0qc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019