UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Q9iBgQEdDhe9YJ84c07bA6UatneCfJa2yg3cQJHbaI8='
WHERE
key_id = '50efdeaa30ec597c1188bda1f9c17bb4d77c433f38302ed9dcd2cf9da5ce519a'
AND (
token = 'Q9iBgQEdDhe9YJ84c07bA6UatneCfJa2yg3cQJHbaI8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)