UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4GEswm1/p6S4rYUjcrbfhPv1MagEBbEY0dtVpUhzpn4='
WHERE
key_id = 'ed54d1458652eb46cb69f2efbf49304119038f21d38743c974f88811b1fd2b7c'
AND (
token = '4GEswm1/p6S4rYUjcrbfhPv1MagEBbEY0dtVpUhzpn4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)