UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n9Si/5Zq6R+6BW4IUzC6Drgus0zFg/9yaDFB8ibD6t8=' 
WHERE 
  key_id = 'a3e1cf1614e422ceaaf01bef7e9ff2cb15266ba633d488ce5d13e66c6abc5b9b' 
  AND (
    token = 'n9Si/5Zq6R+6BW4IUzC6Drgus0zFg/9yaDFB8ibD6t8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00070