UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E7rwbtrIsZ9ACGow332GkF4UyKHxv97xs3079wdQg4s=' 
WHERE 
  key_id = '4cdf80759e200c13022c08a4ca16f3ae8b93c19b17c1c8f843a12c0e3316a02b' 
  AND (
    token = 'E7rwbtrIsZ9ACGow332GkF4UyKHxv97xs3079wdQg4s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029