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