UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GwOta2eR2a8uEH5qgrXz3r+XC67zdXn5U+JNwdP230Y='
WHERE
key_id = '1b215db3456f2e0d5878f487454fe5a64e7931f6084a1c7b9b8f8fbb09dfc3c2'
AND (
token = 'GwOta2eR2a8uEH5qgrXz3r+XC67zdXn5U+JNwdP230Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)