UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f3lUII0DyY9tF+P9ZGqPAm8OutuW3xL2gTnR6sjOhbI='
WHERE
key_id = '7caf049241658abce7764b3a3a2878cc3ec66588322a1dcbd020e26309a1d5bd'
AND (
token = 'f3lUII0DyY9tF+P9ZGqPAm8OutuW3xL2gTnR6sjOhbI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)