UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g/ZxoHbpzJdpbDPpHZc4bNPVbBqEVDeHaoFFr0tlm84=' 
WHERE 
  key_id = '817c4b4b2c14e50787f8f5486d90749509381062c5a81832ca7e6edaec1b9c82' 
  AND (
    token = 'g/ZxoHbpzJdpbDPpHZc4bNPVbBqEVDeHaoFFr0tlm84=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029