UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r7CpxP7sd71qPnbPjJVLoekmruuCzccacv6ZnGB3tDM='
WHERE
key_id = 'f2a74c6ed9f5b7d1a56f17db40536402d50433e8d78743a156ef9f2c655a795c'
AND (
token = 'r7CpxP7sd71qPnbPjJVLoekmruuCzccacv6ZnGB3tDM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)