UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Zk91t1etJerwWiQVJngsYEv6Oy5gGt1H0Ny5kNgmpB0='
WHERE
key_id = 'e88f7aba247d1d75a080db29378f3c6410bc824add362abd098bc64ac1a8d80d'
AND (
token = 'Zk91t1etJerwWiQVJngsYEv6Oy5gGt1H0Ny5kNgmpB0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)