UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r7nSA2Xeo/fMN5RTQ0dmFY/lmYDJx2Pezd8TOpw9Bjk='
WHERE
key_id = '7c2451a6ae954c33739eca8ebb9ef7c11f5037d2f77fad016ad2e7ba8082e2c8'
AND (
token = 'r7nSA2Xeo/fMN5RTQ0dmFY/lmYDJx2Pezd8TOpw9Bjk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)