UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cXuOn2VWZ8k9WY0oLKntwFLKzlN+mHYhU+pTCpeSjxI='
WHERE
key_id = '583d3eff78211c79a2cbdfa303f9b4af05090d08701a086fe97e05504f5f8e4d'
AND (
token = 'cXuOn2VWZ8k9WY0oLKntwFLKzlN+mHYhU+pTCpeSjxI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)