UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qKtMo8FwmyWMdDn1LwcaT9EU7mMoR5XM1ZlZd3iIOO8=' 
WHERE 
  key_id = 'a718175da7b3529bda3022659e979c6894918289372ef10da284963bc5f880b8' 
  AND (
    token = 'qKtMo8FwmyWMdDn1LwcaT9EU7mMoR5XM1ZlZd3iIOO8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053