UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aGzyB8EiZj8FS44L++YDKZ0qFj6SjgT7di6GgMX8N1w='
WHERE
key_id = '3dae841b394b738cf7ffe3a49fff14e378b007969ec3443938f1ffd98879d0f8'
AND (
token = 'aGzyB8EiZj8FS44L++YDKZ0qFj6SjgT7di6GgMX8N1w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)