UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sFxYlDWN3tScqzCOqn6rIfR0jNRoKCUlyfsOi6uyLcY='
WHERE
key_id = '31e659e0091ddc578173414b1b29415718b6c2b540f07e0b4b60d5d06943a969'
AND (
token = 'sFxYlDWN3tScqzCOqn6rIfR0jNRoKCUlyfsOi6uyLcY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)