UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZSTt5MzCXxEtnILJEOP90cmhyFQD7SwN+xgma1fDfsQ='
WHERE
key_id = '89360be1cb2fc462a1bde1a9ca5489210243f06867294e1ff2fb2afcd0921b56'
AND (
token = 'ZSTt5MzCXxEtnILJEOP90cmhyFQD7SwN+xgma1fDfsQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)