UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9ka4UMVBtWK4BkwGShZU+uQ5QIUvxaYnPBydnyLlSN8=' 
WHERE 
  key_id = 'bf7581445a53ec40dcd71c816d25d4c3b1e497b10cd5c7056378b254fc04a06b' 
  AND (
    token = '9ka4UMVBtWK4BkwGShZU+uQ5QIUvxaYnPBydnyLlSN8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031