UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eLz/AnBF5pigBlZkGf1wn8ozzQGmGY+QF9jIbG8PC+E=' 
WHERE 
  key_id = '7ef09ba5b23044c05e467ac72af8094a27f3508d138bd8069b4500d6112e7885' 
  AND (
    token = 'eLz/AnBF5pigBlZkGf1wn8ozzQGmGY+QF9jIbG8PC+E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031