UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RwVbH99ND6JqNoS+8DR1UiQVIWF762Ebfcs3sgVmvzc=' 
WHERE 
  key_id = '0f1b87d9520eb9d3c53576ede805ddc7bf6893cc86c9f478a3565a27b0e04af1' 
  AND (
    token = 'RwVbH99ND6JqNoS+8DR1UiQVIWF762Ebfcs3sgVmvzc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032