UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'G/Ffxdw+/Zd3flnWCdpn1a77uAYMxm98kftSdrU+1BQ='
WHERE
key_id = '8439790c375cbab8fc52592521a99588160022fbc04a0b2984c139de529062f7'
AND (
token = 'G/Ffxdw+/Zd3flnWCdpn1a77uAYMxm98kftSdrU+1BQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)