UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gnyMrrtIQJQ8w9lIJGPlYF6HJ8B8yQrupZ9wbMPftOQ=' 
WHERE 
  key_id = '9e42e7ac0a37e94355aa2e600f90adb365f7176da0ed0b1e93e9443209372758' 
  AND (
    token = 'gnyMrrtIQJQ8w9lIJGPlYF6HJ8B8yQrupZ9wbMPftOQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036