UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5PfNcpZ6qvIJih7KT81RHV8pzeo6jNH89YTyfQtWOu4='
WHERE
key_id = '3d15a9a13b7badf73830c58d7b0a92017ae09453f4b754a1f8a91aa62138c5f4'
AND (
token = '5PfNcpZ6qvIJih7KT81RHV8pzeo6jNH89YTyfQtWOu4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)