UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nfN7URUcY16WumwoDnQ2EZ7u4njJ3VDdbr/bt0Hm3+8=' 
WHERE 
  key_id = '46a59a17132f1fc91329ade7e21f14d5b8db47dd70a40b58407c0516723b6fc6' 
  AND (
    token = 'nfN7URUcY16WumwoDnQ2EZ7u4njJ3VDdbr/bt0Hm3+8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032