UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6KRDllmGR9kT7yfFUnxoSXe4BsMdGYJ9Q6TqWrja3rE=' 
WHERE 
  key_id = 'c06d8123ca0517af0c38a9c9a7ea77b589d729851da05e07e9656f667266291d' 
  AND (
    token = '6KRDllmGR9kT7yfFUnxoSXe4BsMdGYJ9Q6TqWrja3rE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032