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