UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ew2WTKxjhpAt6GI91mOc3i8ptowVtyGgRWXe0oyJb68='
WHERE
key_id = '1be85eacb86dda14f41d5f097bf2f2df8906d6e9a33d6f1104c551ab460df890'
AND (
token = 'Ew2WTKxjhpAt6GI91mOc3i8ptowVtyGgRWXe0oyJb68='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)