UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BBXuDN4+3X1ECPQiZ5sk4yF5VBhjUUIgBzWUbpE8pXE='
WHERE
key_id = '683da09b4af2f40ac3d9ab64f1453640cede13c6bb854da3b007217b61d37bcd'
AND (
token = 'BBXuDN4+3X1ECPQiZ5sk4yF5VBhjUUIgBzWUbpE8pXE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)