UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bMYZptZFevGaIj8HdcRp5LXGfeZK8NbnMzR/izZcQPg=' 
WHERE 
  key_id = '40a41138b1a3e7e5b2a972ecc8c57fd36d3548593433a1e3064bbc36c34df6a7' 
  AND (
    token = 'bMYZptZFevGaIj8HdcRp5LXGfeZK8NbnMzR/izZcQPg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038