UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B1XkRpods3uvJuyFpGAV95WSwLgnkDMLXTI9x9mss+c='
WHERE
key_id = 'e098a2cca129b57d27dac5b90bfc218ea02f2df5d04379edaca111b6311bb6e0'
AND (
token = 'B1XkRpods3uvJuyFpGAV95WSwLgnkDMLXTI9x9mss+c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)