UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kvTyu+MpLWgImXnpoo9fjf6fDsWyw68WHHEFAdFKshM='
WHERE
key_id = '7c7764298282a7ad9703a1989a9230a870cac812653de8d402f81a1edf948b89'
AND (
token = 'kvTyu+MpLWgImXnpoo9fjf6fDsWyw68WHHEFAdFKshM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)