UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FIs8ejzTjZjeNFA6Q8lS0nr8flPBgdGOCi8reuVfZkc=' 
WHERE 
  key_id = 'dc3730be787a8abc84be49bc3036139f60ffc7a83d40625c0331ce7e4e03ddc5' 
  AND (
    token = 'FIs8ejzTjZjeNFA6Q8lS0nr8flPBgdGOCi8reuVfZkc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00062