UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'na/SBltPWMX0W9xWMPyheI7I7oNEjOBREVCEkKHhkuc=' 
WHERE 
  key_id = '3419aaf064998978d581bbd4a03a4b4169717b9acf1bbda33247ee54cee4ee89' 
  AND (
    token = 'na/SBltPWMX0W9xWMPyheI7I7oNEjOBREVCEkKHhkuc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028