UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A4U5VqD0AfopJ99Xk1z3O4ziPYw+PSWhDDgOajCbOnc=' 
WHERE 
  key_id = 'abc7856a2ade7b898dd4dc363874065fe9f9d1332d0bc06c651134d05c42751a' 
  AND (
    token = 'A4U5VqD0AfopJ99Xk1z3O4ziPYw+PSWhDDgOajCbOnc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016