UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FsPTfrYadaWpbQsjs+bIQQBayOxraH5i/sC+kr9IQAU=' 
WHERE 
  key_id = '7001330e48f5d367bcbfd56eea659bbee344b1c92ced82d35f6660403eed379b' 
  AND (
    token = 'FsPTfrYadaWpbQsjs+bIQQBayOxraH5i/sC+kr9IQAU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034