UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fvkHCJBT4/xdZdVNcmplnbBZl2s+rdRyIiCv/zbFf1s=' 
WHERE 
  key_id = '044fe9f842f05fa8240945449f467a8a03d7e080e61b2ef1d870ebfb8f9e428b' 
  AND (
    token = 'fvkHCJBT4/xdZdVNcmplnbBZl2s+rdRyIiCv/zbFf1s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032