UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'suJXRGied0+Aloyd7CmC2QVnw04JLHx3YXMZeVQ7foY=' 
WHERE 
  key_id = 'e4a0732ef86cd2906b35e3155291c9feaedc0a2c606cfbd1402ed9fd7c946bd6' 
  AND (
    token = 'suJXRGied0+Aloyd7CmC2QVnw04JLHx3YXMZeVQ7foY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033