UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GC3dLfWu8YRBvVmKfay3SuKY8pwOZJVuGk/Co7gokkY='
WHERE
key_id = 'a8ff20f5d6c79c09f308da504c399857fb6d8bdccaefe8f2f481839bc91ce364'
AND (
token = 'GC3dLfWu8YRBvVmKfay3SuKY8pwOZJVuGk/Co7gokkY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)