UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '1EeDpKebGoVLNAwMTyhZJ0edmV7PZqSnM/K2Up6HSuU=' 
WHERE 
  key_id = '3ff59974b952100381a146874c0ad92c63c12adb14a253059bad72ca81713017' 
  AND (
    token = '1EeDpKebGoVLNAwMTyhZJ0edmV7PZqSnM/K2Up6HSuU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00071