UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7+HbWpZ5LI2iYHGR13pdAUV71FNzArXoq2hjzr7uIqA='
WHERE
key_id = 'ba012eb932809e0111b1a37f9a5653a58c0dbe0a364eae4c957240c2d461f961'
AND (
token = '7+HbWpZ5LI2iYHGR13pdAUV71FNzArXoq2hjzr7uIqA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)