UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IS7BvpmAHt+hRnEjVwLcTc1ZfbeEirD/ARPcmi2mrUQ=' 
WHERE 
  key_id = '904630b9f836c7a283fb658290e4be5954d16512a4564d0c659c4d780439d468' 
  AND (
    token = 'IS7BvpmAHt+hRnEjVwLcTc1ZfbeEirD/ARPcmi2mrUQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039