UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tUDmAQrtL+QpyG5L5Iw7as24wlpGVkXLk70p21M0R9Y=' 
WHERE 
  key_id = '040176e4302e89abb9b0706d7a259c7c666e5f6b8b0954af9b67719ad8a4f629' 
  AND (
    token = 'tUDmAQrtL+QpyG5L5Iw7as24wlpGVkXLk70p21M0R9Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035