UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SVi4o4Z1Q8ZlBx9oB9FeGGhpzSYlf+W9cL2+9Kimwpo='
WHERE
key_id = 'c16a465e34af54fb00a4ac15e7c8d7cb287df6d5e140640aa93370bacadec701'
AND (
token = 'SVi4o4Z1Q8ZlBx9oB9FeGGhpzSYlf+W9cL2+9Kimwpo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)