UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mMelii6fAmE5xjHZuo4hu2iPV6ndFnNfZ6aRYjUvGgw=' 
WHERE 
  key_id = '28223dc90f408178fe83ca78be4047d3cfe77924ac47f75a53f992ab966e44e6' 
  AND (
    token = 'mMelii6fAmE5xjHZuo4hu2iPV6ndFnNfZ6aRYjUvGgw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036