UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4J4LyBgnuCEYEWfl8VPPb0tImhuQCgxkx3/b4IrWAcY='
WHERE
key_id = 'b7c034506b18410f585647bb289ab6770455b14afa5c85dbabe9ae4392876ec0'
AND (
token = '4J4LyBgnuCEYEWfl8VPPb0tImhuQCgxkx3/b4IrWAcY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)