UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0jauzQWRutabzin9ZC5oOBCooma9Q3rz1y4wvzb88pI='
WHERE
key_id = '8f3ad6c52bf73efad9836fde19d4c8a6928a542927452ae54d6c0e8000816df9'
AND (
token = '0jauzQWRutabzin9ZC5oOBCooma9Q3rz1y4wvzb88pI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)