UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JTqlA2HpmpkLD9lbdBFVdF0TH4tLKtu17q3dwBXhiVU='
WHERE
key_id = '786d1e33f092c367d4be483600731195e0637aeaf279e2d9ff1b06366f739458'
AND (
token = 'JTqlA2HpmpkLD9lbdBFVdF0TH4tLKtu17q3dwBXhiVU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)